/*
 *    Copyright (c) 2018-2025, nart All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: nart
 */

package com.nai365.nart.ware.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nai365.nart.common.core.to.OrderTO;
import com.nai365.nart.ware.entity.WareSku;
import com.nai365.nart.common.core.to.SkuHasStockTO;
import com.nai365.nart.ware.to.StockLockedTO;
import com.nai365.nart.ware.to.WareSkuLockTO;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 商品库存
 *
 * @author baogs
 * @date 2022-07-02 13:21:19
 */
public interface WareSkuService extends IService<WareSku> {

    @Transactional
    void addStock(Long skuId, Long wareId, Integer skuNum);

	List<SkuHasStockTO> getSkusHasStock(List<Long> skuIds);

	@Transactional
	Boolean orderLockStock(WareSkuLockTO lockTO);

    void unLockStock(StockLockedTO locked) throws Exception;

    @Transactional
    void unLockStock(OrderTO order);

	IPage queryPage(Page page, WareSku wareSku);
}
